import 'package:seedfour/app/models/api_response/api_response_entity.g.dart';
import 'dart:convert';

import 'package:seedfour/generated/json/base/json_field.dart';

class ApiResponseEntity<T> {
	bool? success;
	int? detail;
	ApiResponseError? error;
	T? data;

	ApiResponseEntity();

	factory ApiResponseEntity.fromJson(Map<String, dynamic> json) => $ApiResponseEntityFromJson<T>(json);

	Map<String, dynamic> toJson() => $ApiResponseEntityToJson(this);

	@override
	String toString() {
		return jsonEncode(this);
	}
}

@JsonSerializable()
class ApiResponseError {
	String? code;
	String? message;

	ApiResponseError();

	factory ApiResponseError.fromJson(Map<String, dynamic> json) => $ApiResponseErrorFromJson(json);

	Map<String, dynamic> toJson() => $ApiResponseErrorToJson(this);

	@override
	String toString() {
		return jsonEncode(this);
	}
}